﻿using Customer.API.Applcation.Command.RefundCommand;
using Customer.Infrstructre.ProcurementManager;
using MediatR;
using System.Collections.Generic;

namespace Customer.API.Applcation.CommandHandlers.RefundCommandHandler
{
    public class RefundUpdCommandHandlers : IRequestHandler<RefundUpdCommand, int>
    {
        IRefundRepository rRep;

        public RefundUpdCommandHandlers(IRefundRepository rRep)
        {
            this.rRep = rRep;
        }

        public async Task<int> Handle(RefundUpdCommand request, CancellationToken cancellationToken)
        {

            var list = await rRep.GetModelAsync(request.RefundId);
            list.IsRefund = request.IsRefund;
            await rRep.Update(list);
            return 1;
        }
    }
}
